home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume4 / tvx / part05 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  52.6 KB

  1. From: talcott!seismo!gatech!unmvax!wampler (Bruce Wampler)
  2. Subject: tvx 5 of 10
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 4, Issue 19
  7. Submitted by: gatech!unmvax!wampler (Bruce Wampler)
  8.  
  9. #--------CUT---------CUT---------CUT---------CUT--------#
  10. #########################################################
  11. #                                                       #
  12. # This is a shell archive file.  To extract files:      #
  13. #                                                       #
  14. #    1)    Make a directory (like tvx) for the files.      #
  15. #    2) Write a file, such as "filen.shar", containing  #
  16. #       this archive file into the directory.           #
  17. #    3) Type "sh file.shar".  Do not use csh.           #
  18. #                                                       #
  19. #########################################################
  20. #
  21. #
  22. echo Extracting tvx_2.c:
  23. sed 's/^X//' >tvx_2.c <<\SHAR_EOF
  24. X/* ========================================================================
  25. X
  26. X    tvx_2.c - Part 2 of main TVX code 
  27. X
  28. X============================================================================ */
  29. X
  30. X#include "tvx_defs.ic"        /* note tv_defs will #include stdio.h */
  31. X#include "tvx_glbl.ic"
  32. X
  33. X/* =============================>>> KILLIN <<<============================= */
  34. X  killin(cnt)
  35. X  int cnt;
  36. X  { /* ##  killin - kill cnt lines */
  37. X
  38. X    SLOW int i,lim;
  39. X    SLOW int from,to,ityp,istrt;
  40. X    SLOW int s_curlin, s_curchr, s_echo;
  41. X
  42. X    if (cut_mode)        /* does kill "cut" */
  43. X      {
  44. X    s_echo = echof;
  45. X    echof = FALSE;        /* turn off echo */
  46. X    s_curlin = curlin;    /* save line */
  47. X    save(cnt,FALSE);    /* save those lines */
  48. X    curlin = s_curlin;
  49. X    echof = s_echo;        /* restore things */
  50. X      }
  51. X
  52. X    if (cnt+curlin >= nxtlin || (curlin == nxtlin-1 && cnt >= 0))
  53. X      {             /* special case: deleting rest of buffer */
  54. X    svklin(nxtlin-1);
  55. X    for (i = curlin ; i <= nxtlin-1 ; )
  56. X        kline(*(lines+i++));
  57. X    nxtlin = curlin--;
  58. X    if (curlin > 0)
  59. X      {
  60. X        curchr = *(lines+curlin)+1;
  61. X        newscr();
  62. X      }
  63. X    else
  64. X      {
  65. X        curchr = 0;
  66. X        tvclr();
  67. X      }
  68. X#ifdef SCR_BUF
  69. X    ttflush();
  70. X#endif
  71. X    return;
  72. X      }
  73. X
  74. X    if (cnt < 0)        /* negative kill */
  75. X      {
  76. X    cnt = min(-cnt,curlin-1);    /* all upwards? */
  77. X    dwnlin(-cnt);        /* go up that far */
  78. X      }
  79. X
  80. X    if (cnt != 0)
  81. X      {
  82. X    range(cnt,&to,&from);    /* calculate the line numbers to kill */
  83. X
  84. X    curlin=to;        /* remember new current line */
  85. X
  86. X    svklin(from);    /* save one line */
  87. X    for (i = to ; i <= from ; )        /* mark lines deleted */
  88. X        kline(*(lines+i++));
  89. X
  90. X    lim = min(nxtlin-1,mxline);
  91. X    for (++from ; from <= lim ; )
  92. X      {
  93. X        *(lines+to++) = *(lines+from++);    /* copy next line number */
  94. X      }
  95. X
  96. X    nxtlin=to;
  97. X    if (nxtlin == curlin)
  98. X        --curlin;        /* don't go past end */
  99. X    curchr = *(lines+curlin)+1;    /* remember new current character */
  100. X
  101. X    if (cnt >= 0 && curlin+(tvlins-tvdlin) < nxtlin &&
  102. X      tvdlin < tvlins)    /* killing down */
  103. X      {
  104. X        tvxy(1,tvy);    /* get to start of line */
  105. X        ityp=min(tvlins-tvdlin+1,nxtlin-curlin);
  106. X        if (cnt!=1 || !ckline[0])
  107. X          {
  108. X        tvescr();    /* erase the screen */
  109. X        istrt=curlin;
  110. X          }
  111. X        else
  112. X          {
  113. X        sendcs(ckline);
  114. X        istrt=curlin+ityp-1;
  115. X        tvxy(1,tvlins);
  116. X        ityp=1;
  117. X          }
  118. X        tvtype(istrt,ityp);
  119. X        tvhdln();    /* home to display line */
  120. X      }
  121. X    else if ( cnt != 1)    /* neg and > 1 too complicated */
  122. X        newscr();            /* kill up, just retype whole screen */
  123. X    else if (nxtlin < tvlins)    /* top part of screen */
  124. X      {
  125. X        if (*ckline)        /* kill line defined */
  126. X          {
  127. X        tvxy(1,tvy);        /* get to start of line */
  128. X        sendcs(ckline);        /* just need to kill the line */
  129. X        tvhdln();
  130. X          }
  131. X        else
  132. X        newscr();        /* rewrite it all */
  133. X      }
  134. X    else if (tvdlin < tvlins)    /* must be in last part of buffer */
  135. X      {
  136. X        if (*ckline && *ctopb)    /* kill line & topb defined */
  137. X          {
  138. X        tvxy(1,tvy);        /* get to start of line */
  139. X        sendcs(ckline);        /* kill the line */
  140. X        if (curlin-tvdlin > 0)    /* something to scroll */
  141. X          {
  142. X            tvtopb(1);        /* scroll down one line */
  143. X            tvtype(curlin-tvdlin,1);    /* type the offscreen line */
  144. X            tvdlin++;        /* will start display on next line */
  145. X          }
  146. X        tvhdln();
  147. X          }
  148. X        else
  149. X        newscr();        /* rewrite it all */
  150. X      }
  151. X    else        /* if all else fails */
  152. X        newscr();
  153. X      }
  154. X#ifdef SCR_BUF
  155. X    ttflush();
  156. X#endif
  157. X  }
  158. X
  159. X/* =============================>>> KLINE  <<<============================= */
  160. X  kline(ptr)
  161. X  BUFFINDEX ptr;
  162. X  {  /* kline - kill off the line beginning at buff position ptr */
  163. X
  164. X    SLOW BUFFINDEX i;
  165. X
  166. X    for (i=ptr; *(buff+i) != ENDLINE ; )    /* insert GARBAGE to kill */
  167. X    *(buff+i++) = GARBAGE;
  168. X
  169. X    *(buff+i) = GARBAGE;        /* kill the endline */
  170. X  }
  171. X
  172. X/* =============================>>> KPREV  <<<============================= */
  173. X  kprev()
  174. X  { /* kprev - kill from cursor to beginning of line */
  175. X
  176. X    FAST int chrs;
  177. X
  178. X    svklin(curlin);                /* save one line */
  179. X    chrs = curchr - *(lines+curlin) - 1;    /* how much to delete */
  180. X    if (chrs > 0)
  181. X    delnxt(-chrs);    /* won't cause a combine, so don't worry */
  182. X  }
  183. X
  184. X/* =============================>>> KREST  <<<============================= */
  185. X  krest()
  186. X  { /* krest - kill the rest of the line, not including cursor and ENDLINE */
  187. X
  188. X    SLOW int chrs;
  189. X    SLOW BUFFINDEX i;
  190. X
  191. X    svklin(curlin);    /* save one line */
  192. X    chrs=0;
  193. X    for (i=curchr; *(buff+i)!=ENDLINE; ++i)
  194. X    ++chrs;     /* count how much to delete */
  195. X    if (chrs > 0)
  196. X    delnxt(chrs);    /* won't cause combine, so don't worry */
  197. X  }
  198. X
  199. X/* =============================>>> NEATEN <<<============================= */
  200. X  int neaten(count)
  201. X  int count;
  202. X  {  /* neaten - fill lines to current margin */
  203. X
  204. X    SLOW int oldef, i;
  205. X    SLOW BUFFINDEX linbeg;
  206. X    SLOW int retval;
  207. X
  208. X    retval = TRUE;
  209. X    oldef = echof;
  210. X    if (count > 1)
  211. X    echof = FALSE;
  212. X    if (wraplm <= 1 || curlin >= nxtlin-1)
  213. X    goto l900;        /* work only if wrap limit turned on */
  214. X
  215. X    for (i=1 ; i<=count ; ++i)
  216. X      {
  217. X    beglin();        /* start at beginning of line */
  218. X    if (curlin >= nxtlin-1)
  219. X        goto l900;
  220. X
  221. X    /* don't neaten leading space, cr, period or tab */
  222. X
  223. X    if (*(buff+curchr) == '.')
  224. X      {
  225. X        dwnlin(1);
  226. X        continue;        /* skip dot commands */
  227. X      }
  228. X
  229. X    while (*(buff+curchr)== ' ' || *(buff+curchr)==ENDLINE
  230. X      || *(buff+curchr) == 9)
  231. X      {
  232. X        right(1);    /* skip this line */
  233. X      }
  234. X
  235. X    do
  236. X      {
  237. X        if (*(buff+curchr) == ENDLINE)
  238. X          {
  239. X        if (tvx+leftmg < wraplm)    /* combine lines! */
  240. X          {
  241. X            linbeg = *(lines+curlin+1)+1;
  242. X            /* pt to first char of next line */
  243. X            if (*(buff+linbeg) == ' ' || *(buff+linbeg) == ENDLINE
  244. X              || *(buff+linbeg) == 9 || *(buff+linbeg) == '.')
  245. X              {
  246. X            dwnlin(1);
  247. X            break;    /* no more combining */
  248. X              }
  249. X            if (! neat1(1,32))
  250. X            goto l990;
  251. X            goto NEATNEXT;    /* tab over another word */
  252. X          }
  253. X        else
  254. X          {
  255. X            dwnlin(1);    /* no more combining on line */
  256. X            break;
  257. X          }
  258. X          }
  259. X
  260. XNEATNEXT:
  261. X        if (*(buff+curchr-1)==' ' && tvx+leftmg >= wraplm)    /* change to cr */
  262. X          {
  263. X        if (! neat1(-1,CR))    /* delete the blank */
  264. X            goto l990;
  265. X        break;
  266. X          }
  267. X        wordr(1);
  268. X      } /*# end of the repeat */
  269. X    while (1);
  270. X      } /*# end of the for     */
  271. Xl900:
  272. X    echof = oldef;
  273. X    if (oldef && count > 1)
  274. X    newscr();
  275. X#ifdef SCR_BUF
  276. X    else
  277. X    ttflush();
  278. X#endif
  279. X
  280. X    return (retval);
  281. X
  282. Xl990:                /* failure return */
  283. X    retval = FALSE;
  284. X    goto l900;
  285. X  }
  286. X
  287. X/* =============================>>> NEAT1  <<<============================= */
  288. X  neat1(dir, val)
  289. X  int dir, val;
  290. X  {  /* change character dir to val */
  291. X
  292. X    SLOW int oldwrp;
  293. X
  294. X    oldwrp = wraplm;
  295. X    wraplm = 0;
  296. X    if (! delnxt(dir))
  297. X    goto l900;
  298. X    if (! ins_chr(val))
  299. X    goto l900;
  300. X    wraplm = oldwrp;
  301. X    return (TRUE);
  302. Xl900:
  303. X    wraplm = oldwrp;
  304. X    return (FALSE);
  305. X  }
  306. X
  307. X/* =============================>>> NEWSCR <<<============================= */
  308. X  newscr()
  309. X  { /* newscr - retype entire screen, updating cursor position if necessary */
  310. X
  311. X   SLOW int ibeg,cnt;
  312. X
  313. X    if (tvlins != tvhardlines || nxtlin-1 <= tvlins)
  314. X    /* two kinds of screen rewrite */
  315. X    tvclr();            /* clear the screen and home */
  316. X    else
  317. X    tvxy(1,1);
  318. X
  319. X    finddl(&ibeg,&cnt);     /* calculate where it will go */
  320. X    tvtype(ibeg,cnt);        /* type it out */
  321. X    tvhdln();            /* home to display line */
  322. X#ifdef SCR_BUF
  323. X    ttflush();
  324. X#endif
  325. X  }
  326. X
  327. X/* =============================>>> OPENLN <<<============================= */
  328. X  openln(cnt)
  329. X  int cnt;
  330. X  {  /* openln - open a new line */
  331. X
  332. X    FAST int i;
  333. X    SLOW int pcnt, oldauto;
  334. X
  335. X    oldauto = autoin; autoin = FALSE;    /* don't allow autoindent */
  336. X    pcnt = cnt >= 0 ? cnt : (-cnt);    /* only allow positive opens */
  337. X    for (i=1; i<=pcnt; ++i)
  338. X    ins_chr(CR);    /* insert right number of newlines */
  339. X    dwnlin(-pcnt);    /* and goto beginning of the opened line */
  340. X    endlin();
  341. X    autoin = oldauto;
  342. X#ifdef SCR_BUF
  343. X    ttflush();
  344. X#endif
  345. X  }
  346. X
  347. X/* =============================>>> RANGE  <<<============================= */
  348. X  range(cnt,lbeg,lend)
  349. X  int cnt,*lbeg,*lend;
  350. X  { /* determine a legal line number range given cnt */
  351. X
  352. X    if (cnt <= 0)
  353. X      {
  354. X    *lbeg=max(curlin+cnt,1);
  355. X    *lend=curlin;
  356. X    if (cnt < 0)
  357. X       *lend = (*lend)-1;
  358. X      }
  359. X    else
  360. X      {
  361. X    *lbeg=curlin;
  362. X    *lend=min(nxtlin-1,curlin+cnt-1);
  363. X      }
  364. X }
  365. X
  366. X/* =============================>>> RIGHT  <<<============================= */
  367. X  right(cnt)
  368. X  int cnt;
  369. X  {  /* move cursor right cnt characters
  370. X    newlines count as one character */
  371. X
  372. X    FAST int change,i;
  373. X
  374. X    change=0;            /* nochange yet */
  375. X    if (cnt > 0)
  376. X      {
  377. X    for (i = 1 ; i <= cnt ; ++i)
  378. X      {
  379. X        if (*(buff+curchr)==ENDLINE)
  380. X          {
  381. X        if (curlin+1 >= nxtlin)
  382. X            break;        /* don't go beyond end! */
  383. X        ++curlin;
  384. X        ++change;        /* we've gone down one line */
  385. X        curchr = *(lines+curlin)+1;
  386. X          }
  387. X        else
  388. X        ++curchr;
  389. X      }
  390. X      }
  391. X    else if (cnt < 0)
  392. X      {
  393. X    cnt=(-cnt);
  394. X    for (i = 1 ; i <= cnt ; ++i)
  395. X      {
  396. X        --curchr;
  397. X        if (*(buff+curchr) == BEGLINE)
  398. X          {
  399. X        if (curlin > 1)
  400. X          {
  401. X            --curlin;
  402. X            --change;
  403. X            for (curchr = *(lines+curlin) ; *(buff+curchr)!=ENDLINE ;
  404. X              ++curchr)
  405. X            ;    /* bump curchr to end of the line */
  406. X          }
  407. X        else
  408. X          {
  409. X            ++curchr;
  410. X            break;
  411. X          }
  412. X          }
  413. X      }
  414. X      }
  415. X    if (change != 0)        /* don't do unnecessary change */
  416. X    update(change);
  417. X    tvhdln();
  418. X#ifdef SCR_BUF
  419. X    ttflush();
  420. X#endif
  421. X  }
  422. X
  423. X/* =============================>>> SEARCH <<<============================= */
  424. X  search(lexcnt,iarg)
  425. X  int lexcnt,iarg;
  426. X  { /* search - search down in buffer for a pattern */
  427. X
  428. X    SLOW char chr,c0,c1,c2;
  429. X    static int slines;
  430. X    SLOW int oldx,oldy,oldlin;
  431. X    SLOW int change, searchv, lininc, newln, fold_wild;
  432. X    SLOW int l,lbeg,is;
  433. X    SLOW BUFFINDEX ib, bbeg, oldpos, nbbeg;
  434. X    FAST int i;
  435. X
  436. X    SLOW int how_match, set_len;    /* how wild card matching happens */
  437. X    char *cp, *s_getset();
  438. X    SLOW int w_len,inset,extra_len;        /* length of match */
  439. X
  440. X    static int lastsb = 0;
  441. X
  442. X    lininc = (lexcnt >= 0 ) ? 1 : (-1);
  443. X    searchv = FALSE;
  444. X    newln = FALSE;        /* haven't rubbed out 2nd line */
  445. X
  446. X    oldpos = curchr;        /* need to remember for -f */
  447. X    oldx = tvx ; oldy = tvy ; oldlin = curlin;
  448. X
  449. X    ins_mode = TRUE;        /* so ttymode can echo right */
  450. X
  451. X    if (! iarg)
  452. X    goto l100;        /* get arg form search buffer */
  453. X
  454. X    tvmsg("Find?",FALSE);
  455. X
  456. X    if (! grptch(&chr))
  457. X    goto l9000;
  458. X
  459. X    slines=1;            /* only one line so far */
  460. X    for (i = 0; chr != ESC && i < 100; ++i)    /* read in the pattern */
  461. X      {
  462. X    if (chr == delkey && rptcnt[rptuse] <= 0) /* edit interactive input */
  463. X      {
  464. X        --i;        /* adjust i for for loop ++i */
  465. X        if (i >= 0)        /* wipe out chars on screen */
  466. X          {
  467. X        if (sbuff[i] == 0)    /* newline */
  468. X          {
  469. X             --slines; ctrlch(CR); newln = TRUE;
  470. X          }
  471. X        else
  472. X          {
  473. X            if (newln)
  474. X              {
  475. X            tvcout('\\');
  476. X            ctrlch(sbuff[i]);
  477. X              }
  478. X            else
  479. X              {
  480. X            tvcout(BACKSPACE);
  481. X            tvcout(' ');
  482. X            tvcout(BACKSPACE);
  483. X            if (sbuff[i] < ' ' && sbuff[i] != 27)
  484. X              {
  485. X                tvcout(BACKSPACE);
  486. X                tvcout(' ');
  487. X                tvcout(BACKSPACE);
  488. X              }
  489. X              }
  490. X          }
  491. X        --i;        /* wipe the character */
  492. X          }
  493. X#ifdef SCR_BUF
  494. X        ttflush();
  495. X#endif
  496. X        gkbd(&chr);        /* get new char */
  497. X        continue;
  498. X      }
  499. X    sbuff[i]=chr;        /* stuff it away */
  500. X    if (chr == LF)
  501. X      {
  502. X#ifdef USELF
  503. X        tvcout(chr);    /*$$$ to ignore lfs in cr/lf systems */
  504. X#endif
  505. X      }
  506. X    else if (chr == CR)
  507. X      {
  508. X        if (rptcnt[rptuse] <= 0)
  509. X        ctrlch(chr);
  510. X        ++slines;
  511. X        sbuff[i]=0;    /* end of a line */
  512. X      }
  513. X    else
  514. X        ctrlch(chr);    /* echo character, handline control chars */
  515. X
  516. X#ifdef SCR_BUF
  517. X        ttflush();
  518. X#endif
  519. X/*# fetch the next character */
  520. X    if (! grptch(&chr))
  521. X        goto l9000;
  522. X      }
  523. X
  524. X    tvcout('$');    /* echo the escape */
  525. X    tvxy(oldx,oldy);    /* return to old location */
  526. X
  527. X    if (i>0)            /* we got a new pattern */
  528. X      {
  529. X    lastsb=i-1;        /* last valid character */
  530. X    sbuff[i] = 0;        /* make sure an EOS */
  531. X      }
  532. X    fixend();
  533. X
  534. Xl100:
  535. X    extra_len = 0;
  536. X    if (lininc < 0)
  537. X    endlin();
  538. X    bbeg = curchr;        /* start from current character first time */
  539. X    c0 = sbuff[0];        /* initial char of pattern */
  540. X    if (!xcases)            /* get initial character of pattern */
  541. X    c0 = (c0 >= 'A' && c0 <= 'Z') ? c0+' ' : c0;
  542. X
  543. X    for (l = curlin ; l < nxtlin && l ; l += lininc)  /* l is same as l != 0 */
  544. X      {
  545. X    if ( !c0 )        /* !c0 same as c0 == 0 */
  546. X      {
  547. X        if (lastsb == 0)    /* matching cr only? */
  548. X          {
  549. X        dwnlin(1);    /* go down one line */
  550. X        newscr();    /* screen needs updating */
  551. X        goto l8000;
  552. X          }
  553. X        else
  554. X          {
  555. X        for (ib = bbeg; *(buff+ib); ++ib)
  556. X            ;
  557. X        goto l1000;
  558. X          }
  559. X      }
  560. X
  561. Xl900:
  562. X    if (c0 < ' ')    /* save time, check if might be w.c. once */
  563. X      {
  564. X        ib = bbeg;
  565. X        if (*(buff+ib))
  566. X        goto l1000;
  567. X      }
  568. X
  569. X    for (ib=bbeg; *(buff+ib); ++ib)    /* search current line */
  570. X      {
  571. X        c2 = *(buff+ib);    /* next char of buffer */
  572. X        if (!xcases)
  573. X        c2 = (c2 >= 'A' && c2 <= 'Z') ? c2+' ' : c2;
  574. X    
  575. X        if (c2 != c0)
  576. X        continue;        /* first characters don't match */
  577. X        else if (lastsb == 0)
  578. X          {         /* one character pattern */
  579. X        curchr = ib+1;
  580. X        curlin = l;
  581. X        goto l5000;    /* successful match */
  582. X          }
  583. X        else
  584. X          {
  585. X        if ((c1 = sbuff[1]) < ' ')    /* possible wild? */
  586. X            goto l1000;
  587. X        c2 = *(buff+ib+1);
  588. X        if (! xcases)    /* fold to lower case */
  589. X          {
  590. X            c1 = (c1 >= 'A' && c1 <= 'Z') ? c1+' ' : c1;
  591. X            c2 = (c2 >= 'A' && c2 <= 'Z') ? c2+' ' : c2; /* clower */
  592. X          }
  593. X        if ( c1 != c2 )
  594. X            continue;    /* first two don't match */
  595. X        else
  596. X            goto l1000;    /* first two match, so possibility */
  597. X          }
  598. X      }
  599. X
  600. X/*    # fall thru => no match on this line */
  601. Xl950:
  602. X    bbeg = *(lines+l+lininc)+1;    /* next beginning character */
  603. X    continue;            /* go check next line */
  604. X                    
  605. Xl1000:                /* we have two characters matching! */
  606. X    nbbeg = ib;        /* beginning of possible match in buff */
  607. X    lbeg = l;         /* current line we are searching */
  608. X    how_match = 1;        /* assume exact match */
  609. X    for (is = -1 ; ++is <= lastsb ; )
  610. X      {
  611. X        if ((c1 = sbuff[is]) < ' ')        /* possible wild card */
  612. X          {
  613. X        if (c1 == W_span)
  614. X          {
  615. X            extra_len--;
  616. X            how_match = 2;        /* span match */
  617. X            continue;            /* keep scanning search pat */
  618. X          }
  619. X        else if (c1 == W_skip)        /* skip? */
  620. X          {
  621. X            extra_len--;
  622. X            how_match = 0;        /* skip match */
  623. X            continue;            /* keep scanning search pat */
  624. X          }
  625. X        else if ((cp = s_getset(c1,&set_len,&fold_wild)) == NULL)    /* not wild */
  626. X            goto NOT_WILD;        /* continue normally */
  627. X         
  628. X    /* ok, to here, then have possible wild card match */
  629. X    
  630. X        w_len = 0;
  631. X
  632. X        for ( ; ; )
  633. X          {
  634. X            chr = *(buff + nbbeg);    /* pick up char */
  635. X            if (fold_wild)        /* fold if not user */
  636. X            chr = clower(chr);
  637. X            if (chr == ENDLINE)        /* break on end of line */
  638. X            break;            /* get out */
  639. X    
  640. X            inset = s_inset(chr,cp,set_len);    /* see if in set */
  641. X            if ((how_match > 0 && inset) || (how_match == 0 && !inset))
  642. X              {
  643. X            nbbeg++;         /* bump to next char */
  644. X            ++w_len;
  645. X            if (how_match == 1)
  646. X                    break;        /* only once on mode 1 */
  647. X              }
  648. X            else
  649. X            break;
  650. X          }
  651. X
  652. X        if (w_len <= 0)
  653. X          {
  654. X            ++bbeg;     /* this part of line doesn't match */
  655. X            extra_len = 0;
  656. X            if (c0 == 0)
  657. X            goto l950;
  658. X            else
  659. X            goto l900;    /* try rest of current line */
  660. X          }
  661. X
  662. X    /* to here, then exit from wild card match */
  663. X        extra_len += w_len - 1;
  664. X        how_match = 1;            /* back to 1 again */
  665. X        continue;        /* leave cursor on 1st unmatched */
  666. X          }
  667. X
  668. XNOT_WILD:
  669. X        c2 = *(buff+nbbeg);
  670. X        if (! xcases)    /* fold to lower case */
  671. X          {
  672. X        c1 = (c1 >= 'A' && c1 <= 'Z') ? c1+' ' : c1;
  673. X        c2 = (c2 >= 'A' && c2 <= 'Z') ? c2+' ' : c2; /* clower */
  674. X          }
  675. X
  676. X        if ( c1 != c2 )
  677. X          {
  678. X        extra_len = 0;
  679. X        ++bbeg;     /* this part of line doesn't match */
  680. X        if (c0 == 0)
  681. X            goto l950;
  682. X        else
  683. X            goto l900;    /* try rest of current line */
  684. X          }
  685. X
  686. X    /* regular matched sequence */
  687. X
  688. X        if (*(buff+nbbeg)==0 && lbeg+1 < nxtlin)
  689. X          {
  690. X        ++lbeg;
  691. X        nbbeg = *(lines+lbeg)+1;    /* point to next character */
  692. X          }
  693. X        else
  694. X        ++nbbeg;
  695. X      }
  696. X
  697. X/*#  fall through => found the pattern */
  698. X    curlin = lbeg;
  699. X    curchr = nbbeg;
  700. X
  701. Xl5000:
  702. X    change = curlin-oldlin;    /* compute real line change */
  703. X    if ((slines > 1 && iarg) || tvdlin == tvlins || newln)
  704. X        newscr();
  705. X    else
  706. X        update(change);
  707. X    goto l8000;
  708. X      }
  709. X    curchr = oldpos;        /* reset things */
  710. X    tvxy(oldx, oldy);
  711. X    if (slines > 1 && iarg)
  712. X    newscr();        /* patch up screen */
  713. X    pat_buff[0] = 0;
  714. X    tverrb("Not found ");    /* announce failure a little */
  715. X    goto l9000;
  716. X
  717. Xl8000:                /* success return */
  718. X    oldlen = lastsb+1+extra_len;        /* remember the length */
  719. X    save_pat();        /* save the find pattern */
  720. X    savlen = (-1);            /* haven't saved lines */
  721. X    searchv = TRUE;
  722. X
  723. Xl9000:
  724. X    ins_mode = FALSE;
  725. X#ifdef SCR_BUF
  726. X    ttflush();
  727. X#endif
  728. X    return (searchv);
  729. X  }
  730. X
  731. X/* =============================>>> S_GETSET <<<============================= */
  732. X  char *s_getset(wildchr,set_len,fold)
  733. X  char wildchr;        /* wild card character */
  734. X  int *set_len, *fold;        /* length of set, fold flag */
  735. X  {
  736. X    static char sets[] =        /* possible sets */
  737. X      {
  738. X    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
  739. X    'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
  740. X    'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
  741. X    '4', '5', '6', '7', '8', '9', '.', ',', '?', '!',
  742. X    '[', ']', '{', '}', '(', ')', '<', '>', '\'','"',
  743. X    '+', '-', '/', '*', '=', '@', '#', '$', '%', '^',
  744. X    '&', '_', '~', '`', '|', '\\', ' ', 9, ';', ':', 0
  745. X      };
  746. X
  747. X    struct wild_set
  748. X      {
  749. X    char wch;
  750. X    int s_start, s_len;
  751. X      };
  752. X
  753. X    static struct wild_set wild_cards[] =
  754. X      {
  755. X    { W_letter,  0, 26 },    /* ^L is a letter, starts at 0, 26 long */
  756. X    { W_digit, 26, 10 },    /* ^D is digit, starts at 26, 10 long */
  757. X    { W_alpha,  0, 36 },    /* ^A is alpha numeric, start at 0, 36 long */
  758. X    { W_punc, 36,  4 },    /* ^P is punctuation, at 36, 4 long */
  759. X    { W_anything,  0, 70 },    /* ^X is any thing, whole set */
  760. X    { W_others, 36, 34 },    /* ^O is non-alphanum, start at 36, 32 long */
  761. X    { 0 ,  0,  0 }    /* end of set */
  762. X      };
  763. X
  764. X    SLOW int i;
  765. X    
  766. X    *fold = FALSE;        /* assume won't fold */
  767. X    if (!use_wild)
  768. X    return NULL;        /* not there if not using! */
  769. X
  770. X    for (i = 0 ; wild_cards[i].wch ; ++i)    /* scan list */
  771. X      {
  772. X    if (wildchr == wild_cards[i].wch)    /* found the one we want */
  773. X      {
  774. X        *set_len = wild_cards[i].s_len;
  775. X        *fold = TRUE;
  776. X        return (&sets[ wild_cards[i].s_start ]);
  777. X      }
  778. X      }
  779. X    if (wildchr == W_user)
  780. X      {
  781. X    *set_len = strlen(user_set);
  782. X    return user_set;
  783. X      }
  784. X    else
  785. X    return NULL;
  786. X
  787. X  }
  788. X  
  789. X/* =============================>>> S_inset <<<============================= */
  790. X  s_inset(c2,cp,set_len)
  791. X  char c2, *cp;
  792. X  int set_len;
  793. X  {
  794. X    FAST int i;
  795. X
  796. X    for (i = 0 ; i < set_len ; ++i)
  797. X    if (c2 == *(cp+i))
  798. X        return TRUE;
  799. X    return FALSE;
  800. X  }
  801. X  
  802. X/* =============================>>> SETPAR <<<============================= */
  803. X  setpar(val,chr)
  804. X  int val;
  805. X  char chr;
  806. X  { /* setpar - reset varoius parameters
  807. X        syntax for setpar is [val]:<let>, where [val] is the new value
  808. X        of the parameter, : is the setpar command, and <let> is the
  809. X        letter of the parameter to set. */
  810. X
  811. X    chr = clower(chr);
  812. X
  813. X    switch (chr)
  814. X      {
  815. X       case 'a':        /* set auto indent */
  816. X         autoin = val > 0;
  817. X        break;
  818. X
  819. X    case 'c':        /* cut mode */
  820. X         cut_mode = val > 0;
  821. X        break;
  822. X
  823. X       case 'e':        /* expand tabs */
  824. X         tabspc = max(val,0);
  825. X        verify(1);        /* need to redisplay */
  826. X        break;
  827. X
  828. X    case 'd':        /* display line */
  829. X        if (val < 1 || val > tvlins)
  830. X        tverrb("Bad par val");
  831. X        else
  832. X          {
  833. X        dsplin=val;
  834. X        verify(1);
  835. X          }
  836. X        break;
  837. X
  838. X       case 'f':        /* set find mode */
  839. X        xcases = val <= 0;
  840. X        break;
  841. X
  842. X    case 'm':        /* match wild cards */
  843. X        use_wild = val;
  844. X        break;
  845. X
  846. X    case 'o':
  847. X        if (rdonly)
  848. X          {
  849. X        tverrb("Can't :o, R/O");
  850. X        break;
  851. X          }
  852. X        tvclr();
  853. X        ask("New output file name: ",dest_file,FNAMESIZE);
  854. X        if (*dest_file)
  855. X        rdonly = FALSE;
  856. X        verify(1);
  857. X        break;
  858. X
  859. X    case 's':        /* scroll lines */
  860. X        if (val < 0 || val > dsplin-1)
  861. X        tverrb("Bad par val");
  862. X        else
  863. X        scroll=val;
  864. X        break;
  865. X
  866. X    case 't':        /* tty mode */
  867. X        tvclr();
  868. X        ttymode = val;
  869. X        ttynext = 1000;
  870. X        verify(1);
  871. X        break;
  872. X
  873. X    case 'r':        /* change repeat buffer in use */
  874. X        if (val < 1 || val > REPEATBUFS)
  875. X        tverrb("Bad par val");
  876. X        else
  877. X        rptuse=val-1;    /* adjust for 0 index int */
  878. X        break;
  879. X
  880. X    case 'u':
  881. X        tvclr();
  882. X        ask("Enter user wild card set: ",user_set,39);
  883. X        verify(1);
  884. X        break;
  885. X
  886. X    case 'v':        /* virtual window size */
  887. X        if (val < 3 || val > tvhardlines)
  888. X        tverrb("Bad par val");
  889. X        else
  890. X          {
  891. X        tvlins = val;            /* set to new display line */
  892. X        ddline = (tvlins / 2) + 1;    /* fix home line */
  893. X        setdscrl();            /* set scroll value */
  894. X        dsplin = ddline;        /* reset these */
  895. X        scroll = dscrl;
  896. X        verify(1);            /* update the screen */
  897. X          }
  898. X        break;
  899. X
  900. X    case 'w':        /* change wrap width */
  901. X        wraplm=val;
  902. X        break;
  903. X
  904. X    default:
  905. X        tverrb("Bad par name");
  906. X      }
  907. X#ifdef SCR_BUF
  908. X    ttflush();
  909. X#endif
  910. X  }
  911. X
  912. X/* =============================>>> SNEXT  <<<============================= */
  913. X  snext(lexcnt,iarg)
  914. X  int lexcnt,iarg;
  915. X  { /* snext - find a text pattern across page boundaries */
  916. X
  917. X    SLOW int ihow,pagout;
  918. X
  919. X    if (lexcnt < 0)
  920. X      {
  921. X    tverrb("Search fails");
  922. X    return (FALSE);
  923. X      }
  924. X    
  925. X    ihow=iarg;            /* make a local copy */
  926. X    pagout=FALSE;
  927. X    for(;;)
  928. X      {
  929. X    if (! search(lexcnt,ihow))
  930. X      {
  931. X        wtpage(1);        /* write out current page */
  932. X        ihow=FALSE;        /* don't reread search pattern */
  933. X        pagout=TRUE;
  934. X        if (! rdpage())
  935. X          {
  936. X        tvclr();    /* no more text */
  937. X        tverrb("Search fails");
  938. X        return (FALSE);
  939. X          }
  940. X      }
  941. X    else            /* found it */
  942. X      {
  943. X        if (pagout)
  944. X        newscr();
  945. X#ifdef SCR_BUF
  946. X        else
  947. X        ttflush();
  948. X#endif
  949. X        return (TRUE);
  950. X      }
  951. X      }
  952. X  }
  953. X
  954. X/* =============================>>> STORE_RPT <<<============================= */
  955. X  store_rpt(dummy)
  956. X  int dummy;
  957. X  {    /* start at current cursor position, insert into repeat buffer
  958. X       identified until find >$$ or exceed size limit, deleting as it goes */
  959. X
  960. X    SLOW char chr;
  961. X    SLOW int saved, i, val;
  962. X
  963. X    beglin();        /* start by moving to beginning of current line */
  964. X
  965. X    if ((chr = *(buff+curchr)) != '#')    /* get current char, which must be # */
  966. X      {
  967. X    tverrb("Not a valid rpt buff");
  968. X    return (FALSE);    
  969. X      }
  970. X    val = *(buff+curchr+1)-'0';        /* pick up buffer number */
  971. X
  972. X    if (!chk_rpt_nr(val))
  973. X    return FALSE;
  974. X
  975. X    delnxt(4);                /* delete the #n:< */
  976. X
  977. X    --val;        /* change to relative */
  978. X
  979. X    saved = 0;                /* no previous chars */
  980. X    for (i = 0 ;  ; ++i)
  981. X      {
  982. X    chr = *(buff+curchr);        /* get the character */
  983. X
  984. X    if (chr == ESC && i > 1 && rptbuf[val][i-1] == ESC &&
  985. X        rptbuf[val][i-2] == loop_end)
  986. X      {
  987. X        rptbuf[val][i-2] = 0;    /* set to 0 */
  988. X        nxtrpt[val] = 0;
  989. X        delnxt(2);            /* delete the 27 and following CR */
  990. X#ifdef SCR_BUF
  991. X        ttflush();
  992. X#endif
  993. X        return TRUE;
  994. X      }
  995. X    if (++saved > 99)
  996. X      {
  997. X        tverrb("Only 100 chars in rpt");
  998. X        return FALSE;
  999. X      }
  1000. X    if (chr == ENDLINE)
  1001. X        chr = CR;
  1002. X    rptbuf[val][i] = chr;            /* save the char */
  1003. X    delnxt(1);            /* and delete it */
  1004. X      }
  1005. X  }
  1006. X
  1007. X/* =============================>>> SVKLIN <<<============================= */
  1008. X  svklin(lin)
  1009. X  int lin;
  1010. X  { /* svklin - save one line that will be killed */
  1011. X
  1012. X    SLOW BUFFINDEX from,to;
  1013. X
  1014. X    to=0;
  1015. X    for (from= *(lines+lin)+1; *(buff+from)!=ENDLINE; ++from)
  1016. X      {
  1017. X    unkbuf[to]= *(buff+from);    /* put it in unkill buffer */
  1018. X    to = min(130,to+1);
  1019. X      }
  1020. X    unkbuf[to]=0;
  1021. X  }
  1022. X
  1023. X/* =============================>>> TOPPAG <<<============================= */
  1024. X  toppag()
  1025. X  { /* toppag - move cursor to top of the page */
  1026. X
  1027. X    curlin=1;
  1028. X    curchr = *(lines+1)+1;        /* first char of buffer */
  1029. X    newscr();
  1030. X  }
  1031. X
  1032. X/* =============================>>> TVIDEFS <<<============================= */
  1033. X  tvidefs()
  1034. X  { /* initialize these AFTER opening, defaults set by -c */
  1035. X
  1036. X    dsplin=ddline;
  1037. X    scroll=dscrl;
  1038. X    xcases=dxcase;
  1039. X  }
  1040. X
  1041. X/* =============================>>> TVINIT <<<============================= */
  1042. X  tvinit()
  1043. X  { /* perform initializations needed for tv edit */
  1044. X
  1045. X    FAST BUFFINDEX i;
  1046. X    FAST char *chrp;
  1047. X    SLOW char *lim;
  1048. X    char *malloc();
  1049. X
  1050. X#ifdef MSDOS
  1051. X    BUFFINDEX coreleft();        /* !!! cii-86 dependent */
  1052. X#endif
  1053. X
  1054. X/*    This is a time eater if a big buffer -- if your loader inits
  1055. X    mem to some known value, it might be possible to change GARBAGE
  1056. X    to that value (be sure no other conflicts, like EOS == 0)     */
  1057. X
  1058. X/* try for maximum size buffer */
  1059. X
  1060. X#ifndef GEMDOS
  1061. X    if ((lines = (BUFFINDEX *) malloc((MAXLINE+1)*sizeof(BUFFINDEX)))
  1062. X       == NULL)        /* line pointer array */
  1063. X    exit(1);
  1064. X#else
  1065. Xif ((lines=(BUFFINDEX *)malloc((unsigned int)((MAXLINE+1)*sizeof(BUFFINDEX))) )
  1066. X       == NULL)        /* line pointer array */
  1067. X    exit(1);
  1068. X#endif
  1069. X
  1070. X#ifdef UNIX
  1071. X    for (mxbuff=MAXBUFF ; (buff = malloc(mxbuff+2))==NULL ; mxbuff -= 1000)
  1072. X    ;            /* text buffer pointer */
  1073. X#endif
  1074. X#ifdef OSCPM
  1075. X    for (mxbuff=MAXBUFF ; (buff = malloc(mxbuff+2))==NULL ; mxbuff -= 1000)
  1076. X    ;            /* text buffer pointer */
  1077. X#endif
  1078. X#ifdef GEMDOS
  1079. X    for (mxbuff = 60000L ; (buff = malloc((unsigned int) (mxbuff+2)))==NULL
  1080. X      ; mxbuff -= 1000L)
  1081. X    ;            /* text buffer pointer */
  1082. X#endif
  1083. X#ifdef MSDOS            /* *** Cii-86 C compiler dependent! */
  1084. X
  1085. X    /* cii-86 requires you to manually leave some memory left over
  1086. X       for the I/O routines to use.  'coreleft' does this. Sigh. */
  1087. X
  1088. X    if ((mxbuff = (coreleft() - 5000) ) > MAXBUFF)
  1089. X    mxbuff = MAXBUFF;
  1090. X    for ( ; (buff = malloc(mxbuff+2))==NULL ; mxbuff -= 1000)
  1091. X    ;            /* text buffer pointer */
  1092. X#endif
  1093. X
  1094. X    mxline = MAXLINE;
  1095. X
  1096. X    lim = buff + mxbuff;
  1097. X    for (chrp = buff ; chrp <= lim ; *chrp++ = GARBAGE )
  1098. X    ;    /* mark as all garbage */
  1099. X
  1100. X    curlin =            /* init some stuff */
  1101. X    oldlen =
  1102. X    curchr = 0;
  1103. X
  1104. X    xoutcm = leftmg = nxtlin = nxtchr = tvdlin = 1;
  1105. X    *(buff+mxbuff) = ENDLINE;    /* needs to be ENDLINE for save buffer */
  1106. X    nxtsav=mxbuff;        /* point to end of the buffer */
  1107. X
  1108. X    pat_buff[0] = 0;        /* null pattern buffer */
  1109. X
  1110. X
  1111. X    savlin = savlen = (-1);
  1112. X    for (i = 0 ; i < REPEATBUFS ; ++i)
  1113. X      {              /* fix repeat buffers to initial state */
  1114. X    rptbuf[i][0] = rptcnt[i]= nxtrpt[i] = rptbuf[i][1] = 0;
  1115. X      }
  1116. X    rptuse=0;            /* start with first repeat buff */
  1117. X    bakflg = FALSE;
  1118. X    ineof =
  1119. X    echof = TRUE;
  1120. X  }
  1121. X
  1122. X/* =============================>>> TVERR  <<<============================= */
  1123. X  tverr(str)
  1124. X  char str[];
  1125. X  { /* tverr -    display an error message on the last line of the screen
  1126. X               always writes on screen, returns to old position */
  1127. X
  1128. X    SLOW int oldx,oldy,oldxot,oldech;
  1129. X
  1130. X    waserr = TRUE;
  1131. X    oldx=tvx ; oldy=tvy ; oldxot=xoutcm ; oldech=echof;
  1132. X
  1133. X    ttynext = 1000;        /* force new read */
  1134. X
  1135. X    echof = TRUE;            /* always echo! */
  1136. X    tvmsg(str,TRUE);         /* print the message part */
  1137. X    tvxy(oldx,oldy);
  1138. X    xoutcm=oldxot;
  1139. X    echof=oldech;        /* restore to what it was */
  1140. X#ifdef SCR_BUF
  1141. X    ttflush();
  1142. X#endif
  1143. X  }
  1144. X
  1145. X/* =============================>>> TVERRB <<<============================= */
  1146. X  tverrb(str)
  1147. X  char str[];
  1148. X  { /* tverrb - display an error message on the last line of the screen
  1149. X              always writes on screen, returns to old position */
  1150. X
  1151. X    sendcs(cerrbg);
  1152. X    tverr(str);
  1153. X    sendcs(cerred);
  1154. X#ifdef SCR_BUF
  1155. X    ttflush();
  1156. X#endif
  1157. X  }
  1158. X
  1159. X/* =============================>>> TVHDLN <<<============================= */
  1160. X  tvhdln()
  1161. X  { /* tvhdln - home to display line */
  1162. X
  1163. X    SLOW int xf;
  1164. X    xf = findx();
  1165. X    tvxy(xf,tvdlin);
  1166. X  }
  1167. X
  1168. X/* =============================>>> TVMSG  <<<============================= */
  1169. X  tvmsg(str,intty)
  1170. X  char str[];
  1171. X  int intty;
  1172. X  { /* tvmsg - display a message on the last line of the screen */
  1173. X
  1174. X    FAST int i;
  1175. X    SLOW int oldtty;
  1176. X
  1177. X    tvxy(1,tvhardlines);
  1178. X    tvelin();
  1179. X    
  1180. X    oldtty = ttymode;
  1181. X    if (ttymode && intty)
  1182. X      {
  1183. X    ttymode = FALSE;
  1184. X    prompt(">");
  1185. X      }
  1186. X
  1187. X    for (i=0; str[i]; ctrlch(str[i++]))
  1188. X    ;
  1189. X
  1190. X    if (oldtty)        /* end with < if was ttymode */
  1191. X    remark("<");
  1192. X
  1193. X    ttymode = oldtty;
  1194. X#ifdef SCR_BUF
  1195. X    ttflush();
  1196. X#endif
  1197. X  }
  1198. X
  1199. X/* =============================>>> TVTYLN <<<============================= */
  1200. X  tvtyln(chrptr)
  1201. X  BUFFINDEX chrptr;
  1202. X  { /* tvtyln - type a line on the screen without cr/lf */
  1203. X
  1204. X#ifdef ULBD
  1205. X    FAST BUFFINDEX i;
  1206. X
  1207. X    if (cundlb[0] || cboldb[0])    /* check for underline/bold */
  1208. X      {
  1209. X    for (i = *(lines+curlin)+1 ; *(buff+i)!=ENDLINE ; ++i)
  1210. X        if (*(buff+i)==TOGUNDERLINE || *(buff+i)==TOGBOLD)
  1211. X          {
  1212. X        tvxy(1,tvy);
  1213. X        xoutcm=1;
  1214. X        tvplin(*(lines+curlin)+1);
  1215. X        return;
  1216. X          }
  1217. X      }
  1218. X#endif
  1219. X    xoutcm=tvx;
  1220. X    tvplin(chrptr);
  1221. X#ifdef SCR_BUF
  1222. X    ttflush();
  1223. X#endif
  1224. X  }
  1225. X
  1226. X/* =============================>>> UNKILL <<<============================= */
  1227. X  int unkill()
  1228. X  { /* unkill the single last line killed */
  1229. X
  1230. X    SLOW char chrval;
  1231. X    FAST int i;
  1232. X
  1233. X    openln(1);        /* put the CR 1st - makes update pretty */
  1234. X    for (i=0; unkbuf[i]; ++i)
  1235. X      {
  1236. X    chrval = unkbuf[i];
  1237. X    if (! ins_chr(chrval))    /* unkill slowly by using insert */
  1238. X      {
  1239. X        return (FALSE);
  1240. X      }
  1241. X      }
  1242. X    dwnlin(1);        /* back to where we were */
  1243. X    return (TRUE);
  1244. X  }
  1245. X
  1246. X/* =============================>>> UPDATE <<<============================= */
  1247. X  update(change)
  1248. X  int change;
  1249. X  { /* update - update the screen when line position has changed
  1250. X        will not be used if any alterations have been made */
  1251. X
  1252. X    SLOW int abschg,bscrol;
  1253. X
  1254. X    if (! echof)
  1255. X    return;
  1256. X    abschg =  change;
  1257. X
  1258. X    bscrol = (ctopb[0]==0) ? 0 : scroll;
  1259. X
  1260. X    if (change < 0)            /* have to scroll screen down */
  1261. X      {
  1262. X    abschg = (-change);
  1263. X    if (tvdlin-abschg < 1)
  1264. X        newscr();
  1265. X    else if (curlin < tvdlin)    /* won't fit exactly */
  1266. X      {
  1267. X        if (tvdlin >= dsplin-scroll && abschg!=1)
  1268. X          {
  1269. X        tvclr();        /* clear the screen */
  1270. X        tvtype(1,tvlins);    /* type out a screen */
  1271. X          }
  1272. X        tvdlin=curlin;
  1273. X      }
  1274. X    else if (tvdlin-abschg >= dsplin-scroll)
  1275. X        tvdlin -= abschg;
  1276. X    else
  1277. X      {
  1278. X        if (tvdlin > dsplin-scroll)
  1279. X          {             /* moving up from below display line */
  1280. X        abschg=dsplin-scroll-(tvdlin-abschg);
  1281. X        tvdlin=dsplin-scroll;    /* update */
  1282. X          }
  1283. X        if (ctopb[0]==0)        /* can't do reverse linefeeds */
  1284. X        newscr();        /* no choice, redraw screen */
  1285. X        else
  1286. X          {
  1287. X        tvtopb(abschg);        /* make blank lines at top */
  1288. X        tvtype(curlin-tvdlin+1,abschg);    /* fill in */
  1289. X          }
  1290. X      }
  1291. X      }
  1292. X    else if (change > 0)        /* have to scroll screen up */
  1293. X    if ((tvdlin+change>tvlins && tvdlin<dsplin+bscrol) || change>=tvlins)
  1294. X        newscr();
  1295. X    else if (tvdlin < dsplin+bscrol || nxtlin-1 <= tvlins)
  1296. X        if (tvdlin+change > dsplin+bscrol && nxtlin-1 > tvlins)
  1297. X        newscr();
  1298. X        else
  1299. X        tvdlin += change;
  1300. X    else if (nxtlin-curlin<=tvlins-tvdlin)    /* on bottom part */
  1301. X      {
  1302. X        if (tvdlin<=dsplin+bscrol && abschg!=1)
  1303. X          {
  1304. X        tvclr();        /* rewrite whole screen */
  1305. X        tvtype(nxtlin-tvlins,tvlins);
  1306. X          }
  1307. X        tvdlin=min(tvlins,nxtlin-1)-(nxtlin-curlin)+1;
  1308. X      }
  1309. X    else
  1310. X      {
  1311. X        tvbotb(abschg);        /* make room */
  1312. X        tvxy(1,tvlins-abschg+1);    /* home to right line */
  1313. X        tvtype(curlin+tvlins-tvdlin-abschg+1,abschg);  /* fix up screen */
  1314. X        if (tvdlin < dsplin+bscrol)
  1315. X        tvdlin=dsplin;
  1316. X      }
  1317. X    tvhdln();
  1318. X#ifdef SCR_BUF
  1319. X    ttflush();
  1320. X#endif
  1321. X  }
  1322. X
  1323. X/* =============================>>> WORDR  <<<============================= */
  1324. X  wordr(cnt)
  1325. X  int cnt;
  1326. X  {  /* wordr - move cursor over words */
  1327. X
  1328. X    SLOW int lim,words,incr,lenmov;
  1329. X
  1330. X    lenmov=0;
  1331. X    if (cnt<0)
  1332. X      {
  1333. X    incr = (-1);        /* change */
  1334. X    lim = (-cnt);
  1335. X      }
  1336. X    else if (cnt == 0)
  1337. X      {
  1338. X    incr = -1;
  1339. X    lim = 0;
  1340. X      }
  1341. X    else 
  1342. X      {
  1343. X    incr = 1; 
  1344. X    lim = cnt;
  1345. X      }
  1346. X
  1347. X    for (words=1; words<=lim; ++words)
  1348. X      {
  1349. X    if ((*(buff+curchr)==ENDLINE && incr>0) ||
  1350. X        (*(buff+curchr-1)==BEGLINE && incr<0) )
  1351. X      {
  1352. X        if (curlin+incr==nxtlin || curlin+incr<1)
  1353. X        break;        /* at a buffer limit, so quit */
  1354. X        dwnlin(incr);    /* move up or down */
  1355. X        lenmov += incr;
  1356. X        if (cnt<0)
  1357. X        endlin();
  1358. X        continue;        /* move to next word */
  1359. X      }
  1360. X
  1361. X/* ok, first, skip over word characters */
  1362. X    while (wrdchr(*(buff+curchr)))
  1363. X      {
  1364. X        if (*(buff+curchr-1)==BEGLINE && incr<=0)
  1365. X        goto l100;
  1366. X        else
  1367. X          {
  1368. X        curchr += incr;
  1369. X        lenmov += incr;
  1370. X          }
  1371. X      }
  1372. X
  1373. X/* now skip over remaining non word chars */
  1374. X    while (! wrdchr(*(buff+curchr)))
  1375. X       {
  1376. X        if ((*(buff+curchr)==ENDLINE && incr>0) || (*(buff+curchr-1)==BEGLINE &&
  1377. X          incr<0))
  1378. X        break;
  1379. X        else
  1380. X          {
  1381. X        curchr += incr;
  1382. X        lenmov += incr;
  1383. X          }
  1384. X      }
  1385. Xl100: ;
  1386. X      }
  1387. X
  1388. X    if (incr < 0)        /* move cursor to beginning of word */
  1389. X    while (wrdchr(*(buff+curchr-1)))
  1390. X      {
  1391. X        curchr += incr;
  1392. X        lenmov += incr;
  1393. X      }
  1394. X    tvhdln();
  1395. X#ifdef SCR_BUF
  1396. X    ttflush();
  1397. X#endif
  1398. X    oldlen = lenmov ; savlen=(-1) ;
  1399. X  }
  1400. X
  1401. X/* =============================>>> WRDCHR <<<============================= */
  1402. X  int wrdchr(chr)
  1403. X  char chr;
  1404. X  { /* wrdchr - determine if a character is a "word" type character */
  1405. X
  1406. X    if ((chr>='a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') ||
  1407. X      (chr >= '0' && chr <= '9'))
  1408. X    return (TRUE);
  1409. X    else
  1410. X     return (FALSE);
  1411. X  }
  1412. SHAR_EOF
  1413. echo Extracting tvx_term.ic:
  1414. sed 's/^X//' >tvx_term.ic <<\SHAR_EOF
  1415. X/* -----------------  Various terminal definitions ---------------------- */
  1416. X/* ********************************************************************** */
  1417. X#ifdef IBMPC
  1418. X    EXTERN int addx = 31;        /* amount to add to get x */
  1419. X    EXTERN int addy = 31;        /* to get y */
  1420. X    EXTERN char cxychr = 0;        /* true if convert xy bin to ascii */
  1421. X    EXTERN char cversn[12] = "IBM-PC";     /* a version to identify config */
  1422. X    EXTERN char cxy1st = 'l';            /* l if line first, c if column 1st */
  1423. X    EXTERN char cxybeg[8] = {18,0,0,0,0,0,0,0};    /* start xy control seq  */
  1424. X    EXTERN char cxymid[8] = {0,0,0,0,0,0,0,0};  /* middle xy control seq */
  1425. X    EXTERN char cxyend[8] = {0,0,0,0,0,0,0,0};  /* end sequence */
  1426. X    EXTERN char cerrbg[8] = {16,0,0,0,0,0,0,0}; /* string to print when errors start */
  1427. X    EXTERN char cerred[8] = {14,0,0,0,0,0,0,0};  /* when errors done */
  1428. X    EXTERN char ctopb[8] = {3,0,0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1429. X    EXTERN char cinit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1430. X    /* start up sequence */
  1431. X    EXTERN char cendit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1432. X    /* to end session */
  1433. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1434. X    EXTERN char celin[8] = {1,0,0,0,0,0,0,0};        /* erase to end of line */
  1435. X    EXTERN char cescr[8] = {2,0,0,0,0,0,0,0};        /* erase to end of screen */
  1436. X    EXTERN char cclears[8]={0,0,0,0,0,0,0,0};    /* clear screen, home cusor */
  1437. X    EXTERN char cdelchr[8]={0,0,0,0,0,0,0,0};    /* delete char on screen */
  1438. X    EXTERN char ccsrcm[8] = {20,0,0,0,0,0,0,0};    /* set cursor to command mode */
  1439. X    EXTERN char ccsrin[8] = {19,0,0,0,0,0,0,0};    /* set cursor to insert mode */
  1440. X    EXTERN char ciline[8] = {3,0,0,0,0,0,0,0};        /* insert a line */
  1441. X    EXTERN char ckline[8] = {6,0,0,0,0,0,0,0};        /* kill a line */
  1442. X    EXTERN char cundlb[8] = {4,0,0,0,0,0,0,0};    /* turn on underline */
  1443. X    EXTERN char cundle[8] = {5,0,0,0,0,0,0,0};    /* turn off underline */
  1444. X    EXTERN char cboldb[8] = {11,0,0,0,0,0,0,0};    /* start bold */
  1445. X    EXTERN char cbolde[8] = {12,0,0,0,0,0,0,0};    /* end bold */
  1446. X
  1447. X    EXTERN int dsp_mem = 0;
  1448. X    EXTERN int ddline = 16;
  1449. X    EXTERN int dscrl = 0;
  1450. X    EXTERN int dxcase = 0;
  1451. X#ifdef USECTRLZ
  1452. X    EXTERN int usecz = 1;
  1453. X#else
  1454. X    EXTERN int usecz = 0;
  1455. X#endif
  1456. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1457. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1458. X    EXTERN char delkey = 8;
  1459. X    EXTERN int tvlins = 25;    /* number of lines on screen */
  1460. X    EXTERN int tvcols = 80;    /* number of columns on screen */
  1461. X    EXTERN int tvhardlines = 25;    /* real number of lines */
  1462. X    EXTERN int tvx = 0;        /* current x cursor position */
  1463. X    EXTERN int tvy = 0;        /* current y cursor position */
  1464. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1465. X    EXTERN int dsplin = 0;     /* the default display line */
  1466. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1467. X    EXTERN int leftmg = 0;    /* left margin of display */
  1468. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1469. X    EXTERN int isibmpc = 1;    /* for possible use with a general version */
  1470. X
  1471. X#endif
  1472. X/* ********************************************************************** */
  1473. X#ifdef TERMCAP
  1474. X    EXTERN int addx = 0;        /* amount to add to get x */
  1475. X    EXTERN int addy = 0;            /* to get y */
  1476. X    EXTERN char cxychr = 0;        /* true if convert xy bin to ascii */
  1477. X    EXTERN char cversn[12] = ":";     /* a version to identify config */
  1478. X    EXTERN char cxy1st = 0;            /* l if line first, c if column 1st */
  1479. X    EXTERN char cxybeg[8] = {0,0,0,0,0,0,0,0};    /* start xy control seq  */
  1480. X    EXTERN char cxymid[8] = {0,0,0,0,0,0,0,0};  /* middle xy control seq */
  1481. X    EXTERN char cxyend[8] = {0,0,0,0,0,0,0,0};  /* end sequence */
  1482. X    EXTERN char cerrbg[8] = {0,0,0,0,0,0,0,0}; /* string to print when errors start */
  1483. X    EXTERN char cerred[8] = {0,0,0,0,0,0,0,0};  /* when errors done */
  1484. X    EXTERN char ctopb[8] = {0,0,0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1485. X    EXTERN char cinit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1486. X    /* start up sequence */
  1487. X    EXTERN char cendit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1488. X    /* to end session */
  1489. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1490. X    EXTERN char celin[8] = {0,0,0,0,0,0,0,0};        /* erase to end of line */
  1491. X    EXTERN char cescr[8] = {0,0,0,0,0,0,0,0};        /* erase to end of screen */
  1492. X    EXTERN char cclears[8]={0,0,0,0,0,0,0,0};    /* clear screen, home cusor */
  1493. X    EXTERN char cdelchr[8]={0,0,0,0,0,0,0,0};    /* delete char on screen */
  1494. X    EXTERN char ccsrcm[8] = {0,0,0,0,0,0,0,0};    /* set cursor to command mode */
  1495. X    EXTERN char ccsrin[8] = {0,0,0,0,0,0,0,0};    /* set cursor to insert mode */
  1496. X    EXTERN char ciline[8] = {0,0,0,0,0,0,0,0};        /* insert a line */
  1497. X    EXTERN char ckline[8] = {0,0,0,0,0,0,0,0};        /* kill a line */
  1498. X    EXTERN char cundlb[8] = {0,0,0,0,0,0,0,0};    /* turn on underline */
  1499. X    EXTERN char cundle[8] = {0,0,0,0,0,0,0,0};    /* turn off underline */
  1500. X    EXTERN char cboldb[8] = {0,0,0,0,0,0,0,0};    /* start bold */
  1501. X    EXTERN char cbolde[8] = {0,0,0,0,0,0,0,0};    /* end bold */
  1502. X
  1503. X    EXTERN int dsp_mem = 0;
  1504. X    EXTERN int ddline = 12;    /* unix really needs scroll window */
  1505. X    EXTERN int dscrl = 6;
  1506. X    EXTERN int dxcase = 0;
  1507. X#ifdef USECTRLZ
  1508. X    EXTERN int usecz = 1;
  1509. X#else
  1510. X    EXTERN int usecz = 0;
  1511. X#endif
  1512. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1513. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1514. X    EXTERN char delkey = 8;
  1515. X    EXTERN int tvlins = 0;    /* number of lines on screen */
  1516. X    EXTERN int tvcols = 0;    /* number of columns on screen */
  1517. X    EXTERN int tvhardlines = 0;    /* real number of lines */
  1518. X    EXTERN int tvx = 0;        /* current x cursor position */
  1519. X    EXTERN int tvy = 0;        /* current y cursor position */
  1520. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1521. X    EXTERN int dsplin = 0;     /* the default display line */
  1522. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1523. X    EXTERN int leftmg = 0;    /* left margin of display */
  1524. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1525. X    EXTERN int isibmpc = 0;    /* for possible use with a general version */
  1526. X
  1527. X#endif
  1528. X/* ********************************************************************** */
  1529. X#ifdef VT100 
  1530. X    EXTERN int addx = 0;        /* amount to add to get x */
  1531. X    EXTERN int addy = 0;            /* to get y */
  1532. X    EXTERN char cxychr = 1;        /* true if convert xy bin to ascii */
  1533. X    EXTERN char cversn[12] = "VT-100";     /* a version to identify config */
  1534. X    EXTERN char cxy1st = 'l';            /* l if line first, c if column 1st */
  1535. X    EXTERN char cxybeg[8] = {27,'[',0,0,0,0,0,0};    /* start xy control seq  */
  1536. X    EXTERN char cxymid[8] = {';',0,0,0,0,0,0,0};  /* middle xy control seq */
  1537. X    EXTERN char cxyend[8] = {'H',0,0,0,0,0,0,0};  /* end sequence */
  1538. X    EXTERN char cerrbg[8] = {7,0,0,0,0,0,0,0}; /* string to print when errors start */
  1539. X    EXTERN char cerred[8] = {0,0,0,0,0,0,0,0};  /* when errors done */
  1540. X    EXTERN char ctopb[8] = {27,'M',0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1541. X    EXTERN char cinit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1542. X    /* start up sequence */
  1543. X    EXTERN char cendit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1544. X    /* to end session */
  1545. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1546. X    EXTERN char celin[8] = {27,'[','K',0,0,0,0,0}; /* erase to end of line */
  1547. X    EXTERN char cescr[8] = {27,'[','J',0,0,0,0,0};        /* erase to end of screen */
  1548. X    EXTERN char cclears[8]={0,0,0,0,0,0,0,0};    /* clear screen, home cusor */
  1549. X    EXTERN char cdelchr[8]={0,0,0,0,0,0,0,0};    /* delete char on screen */
  1550. X    EXTERN char ccsrcm[8] = {0,0,0,0,0,0,0,0};    /* set cursor to command mode */
  1551. X    EXTERN char ccsrin[8] = {0,0,0,0,0,0,0,0};    /* set cursor to insert mode */
  1552. X    EXTERN char ciline[8] = {0,0,0,0,0,0,0,0};        /* insert a line */
  1553. X    EXTERN char ckline[8] = {0,0,0,0,0,0,0,0};        /* kill a line */
  1554. X    EXTERN char cundlb[8] = {0,0,0,0,0,0,0,0};    /* turn on underline */
  1555. X    EXTERN char cundle[8] = {0,0,0,0,0,0,0,0};    /* turn off underline */
  1556. X    EXTERN char cboldb[8] = {0,0,0,0,0,0,0,0};    /* start bold */
  1557. X    EXTERN char cbolde[8] = {0,0,0,0,0,0,0,0};    /* end bold */
  1558. X
  1559. X    EXTERN int dsp_mem = 0;
  1560. X    EXTERN int ddline = 16;
  1561. X    EXTERN int dscrl = 0;
  1562. X    EXTERN int dxcase = 0;
  1563. X#ifdef USECTRLZ
  1564. X    EXTERN int usecz = 1;
  1565. X#else
  1566. X    EXTERN int usecz = 0;
  1567. X#endif
  1568. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1569. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1570. X    EXTERN char delkey = 8;
  1571. X    EXTERN int tvlins = 24;    /* number of lines on screen */
  1572. X    EXTERN int tvcols = 80;    /* number of columns on screen */
  1573. X    EXTERN int tvhardlines = 24;    /* real number of lines */
  1574. X    EXTERN int tvx = 0;        /* current x cursor position */
  1575. X    EXTERN int tvy = 0;        /* current y cursor position */
  1576. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1577. X    EXTERN int dsplin = 0;     /* the default display line */
  1578. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1579. X    EXTERN int leftmg = 0;    /* left margin of display */
  1580. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1581. X    EXTERN int isibmpc = 0;    /* for possible use with a general version */
  1582. X#endif
  1583. X/* ********************************************************************** */
  1584. X#ifdef ATARI520                /* like a 25 line VT-52! */
  1585. X    EXTERN int addx = 31;        /* amount to add to get x */
  1586. X    EXTERN int addy = 31;            /* to get y */
  1587. X    EXTERN char cxychr = 0;        /* true if convert xy bin to ascii */
  1588. X    EXTERN char cversn[12] = "520ST";     /* a version to identify config */
  1589. X    EXTERN char cxy1st = 'l';            /* l if line first, c if column 1st */
  1590. X    EXTERN char cxybeg[8] = {27,'Y',0,0,0,0,0,0};    /* start xy control seq  */
  1591. X    EXTERN char cxymid[8] = {0,0,0,0,0,0,0,0};  /* middle xy control seq */
  1592. X    EXTERN char cxyend[8] = {0,0,0,0,0,0,0,0};  /* end sequence */
  1593. X    EXTERN char cerrbg[8] = {27,'p',0,0,0,0,0,0}; /* string to print when errors start */
  1594. X    EXTERN char cerred[8] = {27,'q',0,0,0,0,0,0};  /* when errors done */
  1595. X    EXTERN char ctopb[8] = {27,'I',0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1596. X    EXTERN char cinit[20] = {27,'w',27,'e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1597. X    /* start up sequence */
  1598. X    EXTERN char cendit[20] = {27,'v',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1599. X    /* to end session */
  1600. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1601. X    EXTERN char celin[8] = {27,'K',0,0,0,0,0,0};        /* erase to end of line */
  1602. X    EXTERN char cescr[8] = {27,'J',0,0,0,0,0,0};        /* erase to end of screen */
  1603. X    EXTERN char cclears[8]={27,'E',0,0,0,0,0,0};    /* clear screen, home cusor */
  1604. X    EXTERN char cdelchr[8]={27,'M',0,0,0,0,0,0};    /* delete char on screen */
  1605. X    EXTERN char ccsrcm[8] = {0,'y','4',0,0,0,0,0};    /* set cursor to command mode */
  1606. X    EXTERN char ccsrin[8] = {0,'x','4',0,0,0,0,0};    /* set cursor to insert mode */
  1607. X    EXTERN char ciline[8] = {27,'L',0,0,0,0,0,0};        /* insert a line */
  1608. X    EXTERN char ckline[8] = {27,'M',0,0,0,0,0,0};        /* kill a line */
  1609. X    EXTERN char cundlb[8] = {27,'p',0,0,0,0,0,0};    /* turn on underline */
  1610. X    EXTERN char cundle[8] = {27,'q',0,0,0,0,0,0};    /* turn off underline */
  1611. X    EXTERN char cboldb[8] = {27,'p',0,0,0,0,0,0};    /* start bold */
  1612. X    EXTERN char cbolde[8] = {27,'q',0,0,0,0,0,0};    /* end bold */
  1613. X
  1614. X    EXTERN int dsp_mem = 0;
  1615. X    EXTERN int ddline = 16;
  1616. X    EXTERN int dscrl = 0;
  1617. X    EXTERN int dxcase = 0;
  1618. X#ifdef USECTRLZ
  1619. X    EXTERN int usecz = 1;
  1620. X#else
  1621. X    EXTERN int usecz = 0;
  1622. X#endif
  1623. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1624. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1625. X    EXTERN char delkey = 8;
  1626. X    EXTERN int tvlins = 25;    /* number of lines on screen */
  1627. X    EXTERN int tvcols = 80;    /* number of columns on screen */
  1628. X    EXTERN int tvhardlines = 25;    /* real number of lines */
  1629. X    EXTERN int tvx = 0;        /* current x cursor position */
  1630. X    EXTERN int tvy = 0;        /* current y cursor position */
  1631. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1632. X    EXTERN int dsplin = 0;     /* the default display line */
  1633. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1634. X    EXTERN int leftmg = 0;    /* left margin of display */
  1635. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1636. X    EXTERN int isibmpc = 0;    /* for possible use with a general version */
  1637. X#endif
  1638. X/* ********************************************************************** */
  1639. X/* ********************************************************************** */
  1640. X#ifdef H19
  1641. X    EXTERN int addx = 31;        /* amount to add to get x */
  1642. X    EXTERN int addy = 31;            /* to get y */
  1643. X    EXTERN char cxychr = 0;        /* true if convert xy bin to ascii */
  1644. X    EXTERN char cversn[12] = "H19";     /* a version to identify config */
  1645. X    EXTERN char cxy1st = 'l';            /* l if line first, c if column 1st */
  1646. X    EXTERN char cxybeg[8] = {27,'Y',0,0,0,0,0,0};    /* start xy control seq  */
  1647. X    EXTERN char cxymid[8] = {0,0,0,0,0,0,0,0};  /* middle xy control seq */
  1648. X    EXTERN char cxyend[8] = {0,0,0,0,0,0,0,0};  /* end sequence */
  1649. X    EXTERN char cerrbg[8] = {27,'p',0,0,0,0,0,0}; /* string to print when errors start */
  1650. X    EXTERN char cerred[8] = {27,'q',0,0,0,0,0,0};  /* when errors done */
  1651. X    EXTERN char ctopb[8] = {27,'I',0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1652. X    EXTERN char cinit[20] = {27,'w',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1653. X    /* start up sequence */
  1654. X    EXTERN char cendit[20] = {27,'v',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1655. X    /* to end session */
  1656. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1657. X    EXTERN char celin[8] = {27,'K',0,0,0,0,0,0};        /* erase to end of line */
  1658. X    EXTERN char cescr[8] = {27,'J',0,0,0,0,0,0};        /* erase to end of screen */
  1659. X    EXTERN char cclears[8]={27,'E',0,0,0,0,0,0};    /* clear screen, home cusor */
  1660. X    EXTERN char cdelchr[8]={27,'M',0,0,0,0,0,0};    /* delete char on screen */
  1661. X    EXTERN char ccsrcm[8] = {27,'y','4',0,0,0,0,0};    /* set cursor to command mode */
  1662. X    EXTERN char ccsrin[8] = {27,'x','4',0,0,0,0,0};    /* set cursor to insert mode */
  1663. X    EXTERN char ciline[8] = {27,'L',0,0,0,0,0,0};        /* insert a line */
  1664. X    EXTERN char ckline[8] = {27,'M',0,0,0,0,0,0};        /* kill a line */
  1665. X    EXTERN char cundlb[8] = {27,'p',0,0,0,0,0,0};    /* turn on underline */
  1666. X    EXTERN char cundle[8] = {27,'q',0,0,0,0,0,0};    /* turn off underline */
  1667. X    EXTERN char cboldb[8] = {27,'p',0,0,0,0,0,0};    /* start bold */
  1668. X    EXTERN char cbolde[8] = {27,'q',0,0,0,0,0,0};    /* end bold */
  1669. X
  1670. X    EXTERN int dsp_mem = 0;
  1671. X    EXTERN int ddline = 16;
  1672. X    EXTERN int dscrl = 0;
  1673. X    EXTERN int dxcase = 0;
  1674. X#ifdef USECTRLZ
  1675. X    EXTERN int usecz = 1;
  1676. X#else
  1677. X    EXTERN int usecz = 0;
  1678. X#endif
  1679. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1680. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1681. X    EXTERN char delkey = 8;
  1682. X    EXTERN int tvlins = 24;    /* number of lines on screen */
  1683. X    EXTERN int tvcols = 80;    /* number of columns on screen */
  1684. X    EXTERN int tvhardlines = 24;    /* real number of lines */
  1685. X    EXTERN int tvx = 0;        /* current x cursor position */
  1686. X    EXTERN int tvy = 0;        /* current y cursor position */
  1687. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1688. X    EXTERN int dsplin = 0;     /* the default display line */
  1689. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1690. X    EXTERN int leftmg = 0;    /* left margin of display */
  1691. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1692. X    EXTERN int isibmpc = 0;    /* for possible use with a general version */
  1693. X#endif
  1694. X/* ********************************************************************** */
  1695. X#ifdef HP2621
  1696. X    EXTERN int addx = -1;        /* amount to add to get x */
  1697. X    EXTERN int addy = -1;            /* to get y */
  1698. X    EXTERN char cxychr = 1;        /* true if convert xy bin to ascii */
  1699. X    EXTERN char cversn[12] = "HP2621x";     /* a version to identify config */
  1700. X    EXTERN char cxy1st = 'l';            /* l if line first, c if column 1st */
  1701. X    EXTERN char cxybeg[8] = {27,'&','a',0,0,0,0,0};    /* start xy control seq  */
  1702. X    EXTERN char cxymid[8] = {'y',0,0,0,0,0,0,0};  /* middle xy control seq */
  1703. X    EXTERN char cxyend[8] = {'C',0,0,0,0,0,0,0};  /* end sequence */
  1704. X    EXTERN char cerrbg[8] = {7,0,0,0,0,0,0,0}; /* string to print when errors start */
  1705. X    EXTERN char cerred[8] = {0,0,0,0,0,0,0,0};  /* when errors done */
  1706. X    EXTERN char ctopb[8] = {27,'L',0,0,0,0,0,0}; /* top blanks = reverse linefeed */
  1707. X    EXTERN char cinit[20] = {27,'&','j','@',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1708. X    /* start up sequence */
  1709. X    EXTERN char cendit[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  1710. X    /* to end session */
  1711. X    EXTERN char cbotb[8] = {10,0,0,0,0,0,0,0};  /* bottom blank line sequence */
  1712. X    EXTERN char celin[8] = {27,'K',0,0,0,0,0,0};        /* erase to end of line */
  1713. X    EXTERN char cescr[8] = {27,'J',0,0,0,0,0,0};        /* erase to end of screen */
  1714. X    EXTERN char cclears[8]={27,'H',27,'J',0,0,0,0};    /* clear screen, home cusor */
  1715. X    EXTERN char cdelchr[8]={27,'P',0,0,0,0,0,0};    /* delete char on screen */
  1716. X    EXTERN char ccsrcm[8] = {27,'&','j','@',0,0,0,0};    /* set cursor to command mode */
  1717. X    EXTERN char ccsrin[8] = {27,'&','j','B',0,0,0,0};    /* set cursor to insert mode */
  1718. X    EXTERN char ciline[8] = {27,'L',0,0,0,0,0,0};        /* insert a line */
  1719. X    EXTERN char ckline[8] = {27,'M',0,0,0,0,0,0};        /* kill a line */
  1720. X    EXTERN char cundlb[8] = {0,'p',0,0,0,0,0,0};    /* turn on underline */
  1721. X    EXTERN char cundle[8] = {0,'q',0,0,0,0,0,0};    /* turn off underline */
  1722. X    EXTERN char cboldb[8] = {0,'p',0,0,0,0,0,0};    /* start bold */
  1723. X    EXTERN char cbolde[8] = {0,'q',0,0,0,0,0,0};    /* end bold */
  1724. X
  1725. X    EXTERN int dsp_mem = 1;
  1726. X    EXTERN int ddline = 12;
  1727. X    EXTERN int dscrl = 6;
  1728. X    EXTERN int dxcase = 0;
  1729. X#ifdef USECTRLZ
  1730. X    EXTERN int usecz = 1;
  1731. X#else
  1732. X    EXTERN int usecz = 0;
  1733. X#endif
  1734. X    EXTERN int autoin = 0;    /* TRUE if auto indent, FALSE otherwise */
  1735. X    EXTERN int logdef = 0;    /* backup log file by default 0->no, 1-> yes */
  1736. X    EXTERN char delkey = 8;
  1737. X    EXTERN int tvlins = 24;    /* number of lines on screen */
  1738. X    EXTERN int tvcols = 79;    /* number of columns on screen */
  1739. X    EXTERN int tvhardlines = 24;    /* real number of lines */
  1740. X    EXTERN int tvx = 0;        /* current x cursor position */
  1741. X    EXTERN int tvy = 0;        /* current y cursor position */
  1742. X    EXTERN int tvdlin = 0;     /* the "active" display line */
  1743. X    EXTERN int dsplin = 0;     /* the default display line */
  1744. X    EXTERN int tabspc = 8;     /* spacing for tabs */
  1745. X    EXTERN int leftmg = 0;    /* left margin of display */
  1746. X    EXTERN int wraplm = 0;    /* auto wrap? */
  1747. X    EXTERN int isibmpc = 0;    /* for possible use with a general version */
  1748. X#endif
  1749. X/* ********************************************************************** */
  1750. SHAR_EOF
  1751. echo ALL DONE!
  1752. exit 0
  1753.  
  1754.